package com.alinesno.cloud.gateway.admin.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import com.alibaba.fastjson.annotation.JSONField;

/**
 * <p>
 * 
 * </p>
 *
 * @author WeiXiaoJin
 * @since 2020-01-30 09:37:03
 */
@Entity
@Table(name = "gate_rule")
public class GateRuleEntity extends BaseGatewayEntity {

	private static final long serialVersionUID = 1L;

	/**
	 * 选择器id
	 */
	@Column(name = "selector_id")
	private String selectorId;
	
	/**
	 * URL路径前缀(用于识别路径和查询)
	 */
	@Column(name = "unique_prefix" ,unique = true , length = 32) 
	private String uniquePrefix ; 
	
	/**
	 * 匹配方式（0 and 1 or)
	 */
	@Column(name = "match_mode")
	private Integer matchMode;
	/**
	 * 规则名称
	 */
	private String name;
	/**
	 * 是否开启
	 */
	private Integer enabled;
	/**
	 * 是否记录日志
	 */
	private Integer loged;
	/**
	 * 排序
	 */
	private Integer sort;
	/**
	 * 处理逻辑（此处针对不同的插件，会有不同的字段来标识不同的处理，所有存储json格式数据）
	 */
	private String handle;
	/**
	 * 创建时间
	 */
	@Column(name = "date_created")
	@JSONField(format = "yyyy-MM-dd HH:mm:ss")
	private Date dateCreated;
	/**
	 * 更新时间
	 */
	@Column(name = "date_updated")
	@JSONField(format = "yyyy-MM-dd HH:mm:ss")
	private Date dateUpdated;

	public String getUniquePrefix() {
		return uniquePrefix;
	}

	public void setUniquePrefix(String uniquePrefix) {
		this.uniquePrefix = uniquePrefix;
	}

	public void setSelectorId(String selectorId) {
		this.selectorId = selectorId;
	}

	public String getSelectorId() {
		return selectorId;
	}

	public Integer getMatchMode() {
		return matchMode;
	}

	public void setMatchMode(Integer matchMode) {
		this.matchMode = matchMode;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getEnabled() {
		return enabled;
	}

	public void setEnabled(Integer enabled) {
		this.enabled = enabled;
	}

	public Integer getLoged() {
		return loged;
	}

	public void setLoged(Integer loged) {
		this.loged = loged;
	}

	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	public String getHandle() {
		return handle;
	}

	public void setHandle(String handle) {
		this.handle = handle;
	}

	public Date getDateCreated() {
		return dateCreated;
	}

	public void setDateCreated(Date dateCreated) {
		this.dateCreated = dateCreated;
	}

	public Date getDateUpdated() {
		return dateUpdated;
	}

	public void setDateUpdated(Date dateUpdated) {
		this.dateUpdated = dateUpdated;
	}

	@Override
	public String toString() {
		return "GateRuleEntity{" + "selectorId=" + selectorId + ", matchMode=" + matchMode + ", name=" + name
				+ ", enabled=" + enabled + ", loged=" + loged + ", sort=" + sort + ", handle=" + handle
				+ ", dateCreated=" + dateCreated + ", dateUpdated=" + dateUpdated + "}";
	}
}
